class mystr(str):
	def __init__(self,x):
		self.x=x;
	
	def toHan(self):
		chinese=['零','壹','贰','叁','肆','伍','陆','柒','捌','玖'];
		danwei=['元','拾','佰','仟','萬'];
		x=self.x;
		sum="";
		ling=False;
		for y in range(len(x)):
			c=chinese[int(x[len(x)-y-1])];
			if c=='零':
				ling=True;
				continue;
			else:
				if ling==True:
					ling=False;
					sum=c+danwei[y]+'零'+sum;
				else:
					sum=c+danwei[y]+sum;
		if(sum[len(sum)-1]=='零'):
			sum=sum[:len(sum)-1]+'元';
		return sum;
		
x=mystr("123");
print(x.toHan());
y=mystr("50030");
print(y.toHan());
z=mystr("5000");
print(z.toHan());
